//


import UIKit

class WP_MainViewController: WP_BasicViewController {
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        self.navigationController?.navigationBar.isHidden = true
    }
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(true)
        self.navigationController?.navigationBar.isHidden = false
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setNavTitle("Preview")
        
        // Do any additional setup after loading the view.
        
        creatView()
        
    }
    //view
    func creatView() {
        let headerView = WP_MainView.init(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight))
        headerView.backgroundColor = UIColor.white
        headerView.delegate = self;
        self.view .addSubview(headerView)
        weak var weakSelf = self
        headerView.Block = {
            let d = WP_InfoViewController()
            weakSelf?.navigationController?.pushViewController(d, animated: true)
        }
    }
    
    override func isShowLeftSetting() -> Bool {
        return false
    }
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destination.
     // Pass the selected object to the new view controller.
     }
     */
    
}

//MARK:delegate
extension WP_MainViewController: WP_MainViewDelegate {
    
    func SendPushView(index: NSInteger){
        
        switch index {
        case 1:
            let d = WP_DailyViewController()
            self.navigationController?.pushViewController(d, animated: true)
        
            break
        case 2:
            let w = WP_WeeklyViewController()
            self.navigationController?.pushViewController(w, animated: true)
            
            break
        case 3:
            let m = WP_MonthlyViewController()
            self.navigationController?.pushViewController(m, animated: true)
            
            break
        case 4:
            let c = WP_CustomerViewController()
            self.navigationController?.pushViewController(c, animated: true)
            
            break
        default:
            break
            
        }
        
    }
}
